/*
 * board.h
 *
 * Created: 6/22/2013 9:51:21 PM
 *  Author: Tim
 */ 


#ifndef BOARD_H_
#define BOARD_H_

#include <avr/io.h>
#include <avr/sfr_defs.h>
#include <stddef.h>
#include <avr/pgmspace.h>

#define setMsk(a,b)		(a |= b)
#define clrMsk(a,b)		(a &= ~(b))	

typedef enum{
	USB_PR		= 0x01,
	AES_PR		= 0x02,
	RTC_PR		= 0x04,
	EVSYS_PR	= 0x05,
	DMA_PR		= 0x06,
	/*DAC*/
	DAC_PR		= 0x10,
	/*ADC*/
	ADC_PR		= 0x20,
	/*AC*/
	AC_PR		= 0x30,
	/*TWI*/
	TWIC_PR		= 0x40,		
	TWIE_PR		= 0x41,
	/*USART*/
	USARTC0_PR	= 0x51,
	USARTC1_PR	= 0x52,
	USARTD0_PR	= 0x53,
	USARTD1_PR	= 0x54,
	USARTE0_PR	= 0x55,
	/*SPI*/
	SPIC_PR		= 0x60,
	SPID_PR		= 0x61,
	SPIE_PR		= 0x62,
	/*HIRES*/
	HIRESC_PR	= 0x70,
	HIRESD_PR	= 0x71,
	HIRESE_PR	= 0x72,
	/*TC1*/
	TC1C_PR		= 0x80,
	TC1D_PR		= 0x81,
	/*TC0*/
	TC0C_PR		= 0x90,
	TC0D_PR		= 0x91,
	TC0E_PR		= 0x92,
	/*Everything*/
	ALL_PR		= 0xFF
}peripheral_t;

void clkInit_32MHz();

void prDisable(peripheral_t pr);

void prEnable(peripheral_t pr);

void brdInit();

void resetDaq();

//extern uint8_t nvmRead(uint8_t nvm_cmd, uint16_t address);

uint8_t ReadCalibrationByte( uint8_t index );
#endif /* BOARD_H_ */